/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.InternationalizableEntity;
import interfaces.InternationalizableEntityDescription;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "educational_level_description")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EducationalLevelDescription.findAll", query = "SELECT e FROM EducationalLevelDescription e"),
    @NamedQuery(name = "EducationalLevelDescription.findByIdEducationalLevelDescription", query = "SELECT e FROM EducationalLevelDescription e WHERE e.idEducationalLevelDescription = :idEducationalLevelDescription"),
    @NamedQuery(name = "EducationalLevelDescription.findByDescription", query = "SELECT e FROM EducationalLevelDescription e WHERE e.description = :description")})
public class EducationalLevelDescription implements Serializable, InternationalizableEntityDescription {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_EDUCATIONAL_LEVEL_DESCRIPTION")
    private Integer idEducationalLevelDescription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumn(name = "EDUCATIONAL_LEVEL", referencedColumnName = "ID_EDUCATIONAL_LEVEL")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private EducationalLevel educationalLevel;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "ID_LANGUAGE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Language language;

    public EducationalLevelDescription() {
    }

    public EducationalLevelDescription(Integer idEducationalLevelDescription) {
        this.idEducationalLevelDescription = idEducationalLevelDescription;
    }

    public EducationalLevelDescription(Integer idEducationalLevelDescription, String description) {
        this.idEducationalLevelDescription = idEducationalLevelDescription;
        this.description = description;
    }

    public Integer getIdEducationalLevelDescription() {
        return idEducationalLevelDescription;
    }

    public void setIdEducationalLevelDescription(Integer idEducationalLevelDescription) {
        this.idEducationalLevelDescription = idEducationalLevelDescription;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public EducationalLevel getEducationalLevel() {
        return educationalLevel;
    }

    public void setEducationalLevel(EducationalLevel educationalLevel) {
        this.educationalLevel = educationalLevel;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEducationalLevelDescription != null ? idEducationalLevelDescription.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EducationalLevelDescription)) {
            return false;
        }
        EducationalLevelDescription other = (EducationalLevelDescription) object;
        if ((this.idEducationalLevelDescription == null && other.idEducationalLevelDescription != null) || (this.idEducationalLevelDescription != null && !this.idEducationalLevelDescription.equals(other.idEducationalLevelDescription))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.EducationalLevelDescription[ idEducationalLevelDescription=" + idEducationalLevelDescription + " ]";
    }

    @Override
    public InternationalizableEntity getEntity() {
        return getEducationalLevel();
    }
    
}
